var QQMapWX = require('../../qqmap-wx-jssdk1.1/qqmap-wx-jssdk.js');
var qqmapsdk;
Page({
  data: {
    longitude:"null",  
    latitude:"null",
    list: [],
    phonehight: '',
    markers:null //标记点
  },
  onLoad: function () {
    // 实例化API核心类
    qqmapsdk = new QQMapWX({
      key: 'V52BZ-3EJCD-E5L47-HUQMR-WY6PZ-5YBCJ'
    });
    wx.getSystemInfo({
      success: (result) => {
        this.setData({
          phonehight: result.windowHeight
        })
      }, //获取用户手机高度
    }),
    wx.getLocation({
      success: res =>{
        console.log(res)
        this.setData({
          longitude:res.longitude,
          latitude:res.latitude
        })
      }
    })
  },
  onShow: function () {
    // 调用接口
    qqmapsdk.search({
      keyword: '酒店',
      success: (res) => {
        this.setData({
          list: res.data
        })
      },
      fail: function (res) {
        console.log(res);
      },
      complete: function (res) {
        console.log(res);
      }
    });
  }
})